// User Routes - 路由定义

const express = require('express')
const router = express.Router()
const userController = require('./controller')
const schemaDataHandler = require('@/middleware/schema')
const { register, login, userInfo } = require('./schema')
const handleMethodNotAllowed = require('@/middleware/methodNotAllowed')

// 注册
router.post('/register', schemaDataHandler(register), userController.register)
// 登录
router.post('/login', schemaDataHandler(login), userController.login)
// 获取用户信息
router.get('/userInfo/:id',schemaDataHandler(userInfo),userController.userInfo)

// 自动处理所有路由的方法不匹配情况
handleMethodNotAllowed(router)

module.exports = router
